package top.kaoshanji.p1ch03c;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

/**
 * 代码清单-p1ch03c-89页a：使用@PropertySource注解和Environment
 * @author kaoshanji
 * ^_^
 * create time 2025/4/23 10:54
 */
@Configuration
@PropertySource("classpath:app.properties")
public class BlankDiscEnvironmentConfig {

    @Autowired
    Environment environment;

    @Bean
    public BlankDiscEnvironment disc() {
        return new BlankDiscEnvironment(environment.getProperty("disc.title"), environment.getProperty("disc.artist"));
    }

}
